import static org.junit.Assert.*;

import org.junit.Test;

import cwinsor.raking.year2014.CsvParseRakers;
import cwinsor.raking.year2014.Msg;
import cwinsor.raking.year2014.PersonRaker;
import cwinsor.raking.year2014.PROP_E;
import cwinsor.raking.year2014.PropertyBase;


public class RakerClassTest {

	@Test
	public void testRakerClass() {

		// raker 1 - fresh/new from csv file
		/*                             f    l                    |rp            |rlp           |ta               */
		String base1 = new String("raker,Cole,Winsor");
		String base2 = new String(",5,P,M,v,10");
		String beforeRp  = new String(",9,8,7,6,5,4,3,2");
		String changeRp  = new String(",3,2,1,9,8,7,6,5");
		String beforeRlp = new String(",1,2,3,4,5,6,7,8");
		String beforeTa  = new String(",4,5,6,7,6,5,4,3");

		String expBefore = new String(base1 + base2 + beforeRp + beforeRlp + beforeTa + ",END");
		String chgLine   = new String(base1 + changeRp + ",END");
		String expAfter  = new String(base1 + base2 + changeRp + beforeRp + beforeTa + ",END");
		String observed;

		// convert from csv to Person, to csv
		PersonRaker rc1 = new PersonRaker();
		{
			CsvParseRakers csvParser1 = new CsvParseRakers();
			Boolean foo = csvParser1.parse(expBefore);
			if (!foo) {
				fail("parse returned false");
			}
			rc1.fromCsvAllFields(csvParser1);
		}
		{
			CsvParseRakers csvParser2 = new CsvParseRakers();
			String temp2 = csvParser2.generate(rc1);

			if (!expBefore.equals(temp2)) {
				Msg.note(expBefore);
				Msg.note(temp2);
				fail("string before != string after");
			}
		}


		Msg.note(dM + "test 1 DONE");
	}

	//	@Test
	//	public void testSetProperty() {
	//		Msg.note(dM + "test 2");
	//	}
	/*
	@Test
	public void testGet() {
		fail("Not yet implemented");
	}

	@Test
	public void testFromCsvAllFields() {
		fail("Not yet implemented");
	}

	@Test
	public void testFromCsvNewSchedulePreferences() {
		fail("Not yet implemented");
	}

	@Test
	public void testToCsvAllFields() {
		fail("Not yet implemented");
	}

	@Test
	public void testUpdateSchedulePreferences() {
		fail("Not yet implemented");
	}

	@Test
	public void testEqualsRakerClass() {
		fail("Not yet implemented");
	}
	 */

	// debug message
	String dM = this.getClass().getSimpleName();
}
